package homework_4_minesweeper;

public class MinesweeperUtilities {
    public static int codeToNum(int row,int col,int COL){       //将坐标译成编号
        return row*COL+col;
    }
    public static int returnToRow(int num,int COL){             //将编号解成当前所在行数
        return num/COL;
    }
    public static int returnToCol(int num, int COL){            //将编号解成当前所在列数
        return num%COL;
    }
    public static boolean isValid(int row,int col,int ROW,int COL){     //检测某坐标合不合理，比如是否越界
        return row>=0&&row<ROW&&col>=0&&col<COL;
    }
}
